<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        list-style: none;
        text-decoration: none;
    }

    .box {
        width: 500px;
        height: 300px;
        margin: 30px auto;
        position: relative;
        /* background-color: pink; */
        overflow: hidden;
    }

    img {
        width: 100%;
        height: 100%;
        /* box-sizing: border-box; */
        /* display: inline-block; */

    }

    .box ul {
        white-space: nowrap;
        width: 100%;
        height: 100%;
        /* transform: translateX(-100%); */
        transition: 1s ease;
        font-size: 0;

       
    }

    .box ul li {
        width: 100%;
        display: inline-block;
        height: 100%;
        
    }



    .box1 {
        font-size: 50px;
        position: absolute;
        color: green;
        left: 0;
        top: 40%;
    }

    .box2 {
        font-size: 50px;
        color: green;
        position: absolute;
        right: 0;
        top: 40%;
    }
</style>

<body>
    <div class="box">
        <ul>
            <li class="one"><img src="https://img95.699pic.com/photo/50044/8524.jpg_wh300.jpg" alt=""></li>
            <li class="two"><img src="https://img95.699pic.com/photo/50045/0472.jpg_wh300.jpg" alt=""></li>
            <li class="three"><img src="https://img95.699pic.com/photo/40006/4846.jpg_wh300.jpg" alt=""></li>
        </ul>
        <div class="box1">&lt;</div>
        <div class="box2">&gt;</div>
    </div>
</body>
<script>
    let box = document.querySelector("ul")
    console.log(box);
    let box1 = document.querySelector(".box1")
    let box2 = document.querySelector(".box2")
    let index = 0;
    box1.onclick = function () {
       ++index;
        if(index>2){
            index=0;
        }
        box.style.transform = `translateX(-${index}00%)`;
        
        

    }
    box2.onclick = function () {
        --index;
        if(index<0){
            index=2;
        }
        box.style.transform = `translateX(-${index}00%)`;
        
        console.log(5555);
    }
</script>

</html>